@include('admin.head')
<div class="container">
	<div class="row">
		@include('admin.side')
			<style>
				.rotate180 {
				   filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
				    -moz-transform: rotate(180deg);
				    -o-transform: rotate(180deg);
				    -webkit-transform: rotate(180deg);
				   transform: rotate(180deg);
				}
			</style>
		<div class="col-md-10" id="content-wrapper">
			<ul class="nav nav-tabs">
			  <li class="active"><a href="#home" data-toggle="tab" id="showHome"aria-expanded="true">低碳产品首页</a></li>
			  <li class=""><a href="#project" data-toggle="tab" id="showProject" aria-expanded="true">项目</a></li>
			  <li class=""><a href="#device" data-toggle="tab" id="showDevice" aria-expanded="true">设备</a></li>
			  <li class=""><a href="#tech" data-toggle="tab" id="showTech" aria-expanded="true">技术</a></li>
			  <li class=""><a href="#ass" data-toggle="tab" id="showAss" aria-expanded="true">机构</a></li>
			  <li class=""><a href="#money" data-toggle="tab" id="showMoney" aria-expanded="true">生意圈</a></li>
		  	  <li class=""><a href="#hot" data-toggle="tab" id="showHot" aria-expanded="true">热门</a></li>
			</ul>
			<div id="myTabContent" class="tab-content">
	  			<div class="tab-pane fade active in" id="home">
			    	<div class="panel panel-default">
						<div class="panel-body">
							<div class="form-horizontal">
							    <fieldset>
        						    <div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>项目栏</h2>
											<div class="form-group itemList">
							        		    <label class="col-xs-4  control-label no_padding_right">名称</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size main_body save_use_item" name="mainbody_id">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="addItem">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="itemSub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
										</div>
									</div>
									<div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>技术栏</h2>
											<div class="form-group craftList">
							        		    <label class="col-xs-4  control-label no_padding_right">名称</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size main_body save_use_craft" name="mainbody_id">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="addCraft">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="craftSub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
										</div>
									</div>
									<div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>设备栏</h2>
											<div class="form-group machineList">
							        		    <label class="col-xs-4  control-label no_padding_right">名称</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size main_body save_use_machine" name="mainbody_id">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="addMachine">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="machineSub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
										</div>
									</div>
									<div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>机构栏</h2>
											<div class="form-group agencyList">
							        		    <label class="col-xs-4  control-label no_padding_right">名称</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size save_use_agency">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="addAgency">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="agencySub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
										</div>
									</div>
							    </fieldset>
							</div>
						</div>
					</div>
			  	</div>
			  	<!--项目-->
			  	<div class="tab-pane fade" id="project">
			    	<div class="panel panel-default">
						<div class="panel-body">
							<div class="form-horizontal">
							    <fieldset>
									<div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>项目列表页</h2>
									    	<div class="form-group projectList">
							        		    <label class="col-xs-4  control-label no_padding_right">项目列表页</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size main_body save_use_pro" name="mainbody_id">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="addProject">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="proSub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
		        						</div>
		        					</div>
									<div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>首页</h2>
											<div class="form-group pro_home_List">
							        		    <label class="col-xs-4  control-label no_padding_right">名称</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size save_pro_home">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="add_pro_home">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="pro_home_Sub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
										</div>
									</div>
									<div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>首页大图</h2>
											<div class="form-group pro_pic_List">
							        		    <label class="col-xs-4  control-label no_padding_right">名称</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size save_pro_pic">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="add_pro_pic">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="pro_pic_Sub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
										</div>
									</div>
							    </fieldset>
							</div>
						</div>
					</div>
			  	</div>
			  	<!--设备-->
			  	<div class="tab-pane fade" id="device">
		    		<div class="panel panel-default">
			    		<div class="panel-body">
			    			<div class="form-horizontal">
			    			  	<fieldset>
			            		    <div class="form-group deviceList">
					        		    <label class="col-xs-4  control-label no_padding_right">设备:</label>
					        		    <div class="col-xs-3">
					        		        <select class="form-control input_size main_body save_use_device" name="mainbody_id">
							    	          	<option value="">请选择</option>
					        		        </select>
					        		    </div>
					        		    <div class="col-xs-4  no_padding_both">
					        		      	<button class="btn btn-primary" id="addDevice">添加</button>
					        		    </div>
					        		</div>
					        		<div class="form-group">
									         <div class="col-xs-12 text-center">
												<button type="button" id="deviceSub" class="btn btn-primary ">提交</button>
									        </div>
									    </div>
			    			  	</fieldset>
			    			</div>
			    		</div>
			    	</div>
			  	</div>
			  	<!--技术-->
			  	<div class="tab-pane fade" id="tech">
		    		<div class="panel panel-default">
			    		<div class="panel-body">
			    			<div class="form-horizontal">
			    			  	<fieldset>
			            		    <div class="form-group techList">
					        		    <label class="col-xs-4  control-label no_padding_right">技术:</label>
					        		    <div class="col-xs-3">
					        		        <select class="form-control input_size main_body save_use_tech" name="mainbody_id">
							    	          	<option value="">请选择</option>
					        		        </select>
					        		    </div>
					        		    <div class="col-xs-4  no_padding_both">
					        		      	<button class="btn btn-primary" id="addTech">添加</button>
					        		    </div>
					        		</div>
					        		 <div class="form-group">
									        <div class="col-xs-12 text-center">
												<button type="button" id="techSub" class="btn btn-primary ">提交</button>
									        </div>
									    </div>
			    			  	</fieldset>
			    			</div>
			    		</div>
			    	</div>
			  	</div>
			  	<!--机构-->
			  	<div class="tab-pane fade" id="ass">
		    		<div class="panel panel-default">
			    		<div class="panel-body">
			    			<div class="form-horizontal">
			    			  	<fieldset>
			            		    <div class="form-group assList">
					        		    <label class="col-xs-4  control-label no_padding_right">机构</label>
					        		    <div class="col-xs-3">
					        		        <select class="form-control input_size main_body save_use_ass" name="mainbody_id">
							    	          	<option value="">请选择</option>
					        		        </select>
					        		    </div>
					        		    <div class="col-xs-4  no_padding_both">
					        		      	<button class="btn btn-primary" id="addAss">添加</button>
					        		    </div>

					        		</div>
				        		    <div class="form-group">
								        <div class="col-xs-12 text-center">
											<button type="button" id="assSub" class="btn btn-primary ">提交</button>
								        </div>
								    </div>
			    			  	</fieldset>
			    			</div>
			    		</div>
			    	</div>
			  	</div>
			  	<!--生意圈-->
			  	<div class="tab-pane fade" id="money">
		    		<div class="panel panel-default">
			    		<div class="panel-body">
			    			<div class="form-horizontal">
			    			  	<fieldset>
			            		    <div class="form-group moneyList">
					        		    <label class="col-xs-4  control-label no_padding_right">生意圈</label>
					        		    <div class="col-xs-3">
					        		        <select class="form-control input_size main_body save_use_money" name="mainbody_id">
							    	          	<option value="">请选择</option>
					        		        </select>
					        		    </div>
					        		    <div class="col-xs-4  no_padding_both">
					        		      	<button class="btn btn-primary" id="addMoney">添加</button>
					        		    </div>

					        		</div>
				        		    <div class="form-group">
								        <div class="col-xs-12 text-center">
											<button type="button" id="moneySub" class="btn btn-primary ">提交</button>
								        </div>
								    </div>
			    			  	</fieldset>
			    			</div>
			    		</div>
			    	</div>
			  	</div>
			  	<!--热门-->
			  	<div class="tab-pane fade" id="hot">
			    	<div class="panel panel-default">
						<div class="panel-body">
							<div class="form-horizontal">
							    <fieldset>
									<div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>热门项目栏</h2>
											<div class="form-group hot_item_List">
							        		    <label class="col-xs-4  control-label no_padding_right">名称</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size main_body save_hot_item" name="mainbody_id">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="add_hot_Item">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="hot_item_Sub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
										</div>
									</div>
									<div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>热门技术栏</h2>
											<div class="form-group hot_craft_List">
							        		    <label class="col-xs-4  control-label no_padding_right">名称</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size main_body save_hot_craft" name="mainbody_id">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="add_hot_Craft">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="hot_craft_Sub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
										</div>
									</div>
									<div class="col-xs-12">
										<div class="main-box clearfix">
											<h2>热门设备栏</h2>
											<div class="form-group hot_machine_List">
							        		    <label class="col-xs-4  control-label no_padding_right">名称</label>
							        		    <div class="col-xs-3">
							        		        <select class="form-control input_size main_body save_hot_machine" name="mainbody_id">
									    	          	<option value="">请选择</option>
							        		        </select>
							        		    </div>
							        		    <div class="col-xs-4  no_padding_both">
							        		      	<button class="btn btn-primary" id="add_hot_Machine">添加</button>
							        		    </div>
							        		</div>
		        		        		    <div class="form-group">
		        						         <div class="col-xs-12 text-center">
		        									<button type="button" id="hot_machine_Sub" class="btn btn-primary">提交</button>
		        						        </div>
		        						    </div>
										</div>
									</div>
							    </fieldset>
							</div>
						</div>
					</div>
			  	</div>
			</div>
		</div>
	</div>
</div>
@include("admin.footer")
@include("admin.common")
</body>
<!-- 热门的项目栏 -->

<script type="text/html" id="hotitemTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.name}</option>
{%/each}
</script>

<script type="text/html" id="hotitemsTemp">
<div class="form-group hot_item_List replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_hot_item" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_hot_item">删除</button>
    </div>
</div>
</script>





<!-- 首页的项目栏 -->

<script type="text/html" id="itemTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.name}</option>
{%/each}
</script>

<script type="text/html" id="itemsTemp">
<div class="form-group itemList replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_use_item" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_item">删除</button>
    </div>
</div>
</script>

<!-- 首页的设备栏 -->

<script type="text/html" id="hotmachineTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.name}</option>
{%/each}
</script>

<script type="text/html" id="hotmachinesTemp">
<div class="form-group  hot_machine_List replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_hot_machine" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_hot_machine">删除</button>
    </div>
</div>
</script>

<!-- 首页的技术栏 -->

<script type="text/html" id="hotcraftTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.tech_name}</option>
{%/each}
</script>

<script type="text/html" id="hotcraftsTemp">
<div class="form-group hot_craft_List replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_hot_craft" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_hot_craft">删除</button>
    </div>
</div>
</script>

<!-- 首页的技术栏 -->

<script type="text/html" id="craftTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.tech_name}</option>
{%/each}
</script>

<script type="text/html" id="craftsTemp">
<div class="form-group craftList replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_use_craft" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_craft">删除</button>
    </div>
</div>
</script>

<!-- 首页的设备栏 -->

<script type="text/html" id="machineTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.name}</option>
{%/each}
</script>

<script type="text/html" id="machinesTemp">
<div class="form-group  machineList replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_use_machine" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_machine">删除</button>
    </div>
</div>
</script>

<!-- 首页的机构栏 -->
<script type="text/html" id="agencyTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.userData.company_name}</option>
{%/each}
</script>

<script type="text/html" id="agencysTemp">
<div class="form-group  agencyList replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_use_agency" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_agency">删除</button>
    </div>
</div>
</script>

<!-- 项目 -->
<script type="text/html" id="proTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.name}</option>
{%/each}
</script>

<script type="text/html" id="projectTemp">
<div class="form-group projectList replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_use_pro" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_project">删除</button>
    </div>
</div>
</script>
<!-- 项目的首页 -->
<script type="text/html" id="pro_home_Temp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.name}</option>
{%/each}
</script>

<script type="text/html" id="prohomeTemp">
<div class="form-group pro_home_List replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_pro_home" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_pro">删除</button>
    </div>
</div>
</script>


<!-- 项目的首页大图 -->

<script type="text/html" id="pro_pic_Temp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.name}</option>
{%/each}
</script>

<script type="text/html" id="propicTemp">
<div class="form-group pro_pic_List replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size save_pro_pic" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>

    <div class="col-xs-4  no_padding_both change1">
    	<button class="btn btn-warning del_pro_pic">删除</button>
    </div>
</div>
</script>



<!-- 设备 -->
<script type="text/html" id="devTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.name}</option>
{%/each}
</script>

<script type="text/html" id="deviceTemp">
<div class="form-group deviceList replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size main_body save_use_device" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>
    <div class="col-xs-4  no_padding_both change1">
		<button class="btn btn-warning del_device">删除</button>
	</div>

</div>

</script>


<!-- 技术 -->

<script type="text/html" id="tecTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.tech_name}</option>
{%/each}
</script>

<script type="text/html" id="techTemp">
<div class="form-group techList replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size main_body save_use_tech" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>
    <div class="col-xs-4  no_padding_both change1">
		<button class="btn btn-warning del_tech">删除</button>
	</div>
</div>
</script>

<!-- 机构 -->

<script type="text/html" id="ass1Temp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.userData.company_name}</option>
{%/each}
</script>

<script type="text/html" id="assTemp">
<div class="form-group assList replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size main_body save_use_ass" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>
    <div class="col-xs-4  no_padding_both change1">
		<button class="btn btn-warning del_ass">删除</button>
	</div>
</div>
</script>


<!-- 生意圈 -->
<script type="text/html" id="moneyTemp">
<option value="">请选择</option>
{%each list as value}
<option value="{%value.id}">{%value.profile.nickname}</option>
{%/each}
</script>

<script type="text/html" id="businessTemp">
<div class="form-group moneyList replace">
    <label class="col-xs-4  control-label no_padding_right"></label>
    <div class="col-xs-3">
        <select class="form-control input_size main_body save_use_money" name="mainbody_id">
          	<option value="">请选择</option>
        </select>
    </div>
    <div class="col-xs-4  no_padding_both change1">
		<button class="btn btn-warning del_money">删除</button>
	</div>
</div>
</script>



<script type="text/javascript">
waitingDialog.show('正在加载中...', {dialogSize: 'sm', progressType: 'primary'});

var que = "que";
var url = "<%url('admin')%>/";
// var url = "http://192.168.2.102/tyw/public/admin/";

//热门

// 热门的项目栏
var hotProjects;
$.getq(que, url+"recommend/get_project", function (data){
	console.log(data);
	if(data.success && data.data.length){
		hotProjects = data.data
		var html = template("hotitemTemp", {list : hotProjects});
		$(".save_hot_item").last().html(html);
		$(".save_use_pro").last().html(html);
	}
})

$("#add_hot_Item").click(function(){
	var num  = $(".hot_item_List").length;
	if(num >= 6){
		warning("", "只能添加6个推荐位");
		return;
	}

	var html = template("hotitemsTemp", {});
	$(html).insertAfter($(".hot_item_List").last());
	var html = template("hotitemTemp", {list : hotProjects});
	$(".save_hot_item").last().html(html);
	$(".del_hot_item").unbind("click");
	$(".del_hot_item").bind("click", function(){
		$(this).parents(".hot_item_List").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})

$("#hot_item_Sub").click(function(){
	var hotItemId = [];
	$.each($(".save_hot_item"), function(index, hotitem){
		if($(hotitem).val()){
			hotItemId.push($(hotitem).val());
		}
	});

	$.post(url+"recommend/update_hot_project", {

		data : hotItemId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})
//获得已选热门的项目栏

$.getq(que, url + "recommend/get_hot_project", function(data){
	if(data.success){
		var len = data.data.length;
		$.each(data.data, function(k, v){
			$(".save_hot_item").eq(k).val(v.id);
			if(k < len - 1){
				$("#add_hot_Item").click();
			}
		})
	}
})

// // 热门的设备栏
var hotDevice;
$.getq(que, url+"recommend/get_device", function (data){
	if(data.success && data.data.length){
		 hotDevice = data.data
		var html = template("hotmachineTemp", {list :  hotDevice});
		$(".save_hot_machine").last().html(html);
		// $(".save_use_device").last().html(html);
	}
})

$("#add_hot_Machine").click(function(){
	var num  = $(".hot_machine_List").length;
	if(num >= 6){
		warning("", "只能添加6个推荐位");
		return;
	}

	var html = template("hotmachinesTemp", {});
	$(html).insertAfter($(".hot_machine_List").last());
	var html = template("hotmachineTemp", {list : hotDevice});
	$(".save_hot_machine").last().html(html);
	$(".del_hot_machine").unbind("click");
	$(".del_hot_machine").bind("click", function(){
		$(this).parents(".hot_machine_List").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})

$("#hot_machine_Sub").click(function(){
	var hotmachineId = [];
	$.each($(".save_hot_machine"), function(index, item){
		if($(item).val()){
			hotmachineId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_hot_device", {

		data : hotmachineId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})


// //获得已选首页的设备栏


$.getq(que, url + "recommend/get_hot_device", function(data){
	if(data.success){
		var len = data.data.length;
		$.each(data.data, function(k, v){
			$(".save_hot_machine").eq(k).val(v.id);
			if(k < len - 1){
				$("#add_hot_Machine").click();
			}
		})

	}
})

// 热门的技术栏

var hotTechs;
$.getq(que, url+"recommend/get_tech", function (data){

	if(data.success && data.data.length){
		hotTechs = data.data
		var html = template("hotcraftTemp", {list : hotTechs});
		$(".save_hot_craft").last().html(html);
		// $(".save_use_tech").last().html(html);
	}
})

$("#add_hot_Craft").click(function(){
	var num  = $(".hot_craft_List").length;
	if(num >= 6){
		warning("", "只能添加6个推荐位");
		return;
	}

	var html = template("hotcraftsTemp", {});
	$(html).insertAfter($(".hot_craft_List").last());
	var html = template("hotcraftTemp", {list : hotTechs});
	$(".save_hot_craft").last().html(html);
	$(".del_hot_craft").unbind("click");
	$(".del_hot_craft").bind("click", function(){
		$(this).parents(".hot_craft_List").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})


$("#hot_craft_Sub").click(function(){
	var hotcraftId = [];
	$.each($(".save_hot_craft"), function(index, item){
		if($(item).val()){
			hotcraftId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_hot_tech", {

		data : hotcraftId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})



// //获得已选热门的技术栏


$.getq(que, url + "recommend/get_hot_tech", function(data){
	if(data.success){
		var len = data.data.length;
		$.each(data.data, function(k, v){
			$(".save_hot_craft").eq(k).val(v.id);
			if(k < len - 1){
				$("#add_hot_Craft").click();
			}
		})

	}
})

//首页

// 首页的项目栏
var allProjects;
$.getq(que, url+"recommend/get_project", function (data){
	if(data.success && data.data.length){
		allProjects = data.data
		var html = template("itemTemp", {list : allProjects});
		$(".save_use_item").last().html(html);
		$(".save_use_pro").last().html(html);
	}
})

$("#addItem").click(function(){
	var num  = $(".itemList").length;
	if(num >= 3){
		warning("", "只能添加3个推荐位");
		return;
	}

	var html = template("itemsTemp", {});
	$(html).insertAfter($(".itemList").last());
	var html = template("itemTemp", {list : allProjects});
	$(".save_use_item").last().html(html);
	$(".del_item").unbind("click");
	$(".del_item").bind("click", function(){
		$(this).parents(".itemList").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})

$("#itemSub").click(function(){
	var ItemId = [];
	$.each($(".save_use_item"), function(index, item){
		if($(item).val()){
			ItemId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_index_project", {

		data : ItemId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})


//获得已选首页的项目栏

$.getq(que, url + "recommend/get_index_project", function(data){
	if(data.success){
		var len = data.data.length;
		$.each(data.data, function(k, v){
			$(".save_use_item").eq(k).val(v.id);
			if(k < len - 1){
				$("#addItem").click();
			}
		})
	}
})

// // 首页的设备栏
var allDevice;
$.getq(que, url+"recommend/get_device", function (data){
	if(data.success && data.data.length){
		allDevice = data.data
		var html = template("machineTemp", {list : allDevice});
		$(".save_use_machine").last().html(html);
		$(".save_use_device").last().html(html);
	}
})

$("#addMachine").click(function(){
	var num  = $(".machineList").length;
	if(num >= 3){
		warning("", "只能添加3个推荐位");
		return;
	}

	var html = template("machinesTemp", {});
	$(html).insertAfter($(".machineList").last());
	var html = template("machineTemp", {list : allDevice});
	$(".save_use_machine").last().html(html);
	$(".del_machine").unbind("click");
	$(".del_machine").bind("click", function(){
		$(this).parents(".machineList").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})

$("#machineSub").click(function(){
	var machineId = [];
	$.each($(".save_use_machine"), function(index, item){
		if($(item).val()){
			machineId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_index_device", {

		data : machineId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})


// //获得已选首页的设备栏


$.getq(que, url + "recommend/get_index_device", function(data){
	if(data.success){
		var len = data.data.length;
		$.each(data.data, function(k, v){
			$(".save_use_machine").eq(k).val(v.id);
			if(k < len - 1){
				$("#addMachine").click();
			}
		})

	}
})




// // 首页的技术栏
var allTechs;
$.getq(que, url+"recommend/get_tech", function (data){

	if(data.success && data.data.length){
		allTechs = data.data
		var html = template("craftTemp", {list : allTechs});
		$(".save_use_craft").last().html(html);
		$(".save_use_tech").last().html(html);
	}
})

$("#addCraft").click(function(){
	var num  = $(".craftList").length;
	if(num >= 3){
		warning("", "只能添加3个推荐位");
		return;
	}

	var html = template("craftsTemp", {});
	$(html).insertAfter($(".craftList").last());
	var html = template("craftTemp", {list : allTechs});
	$(".save_use_craft").last().html(html);
	$(".del_craft").unbind("click");
	$(".del_craft").bind("click", function(){
		$(this).parents(".craftList").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})


$("#craftSub").click(function(){
	var craftId = [];
	$.each($(".save_use_craft"), function(index, item){
		if($(item).val()){
			craftId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_index_tech", {

		data : craftId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})



// //获得已选首页的技术栏


$.getq(que, url + "recommend/get_index_tech", function(data){
	if(data.success){
		var len = data.data.length;
		$.each(data.data, function(k, v){
			$(".save_use_craft").eq(k).val(v.id);
			if(k < len - 1){
				$("#addCraft").click();
			}
		})

	}
})


// // 首页的机构栏
var allGroup;
$.getq(que, url+"recommend/get_group", function (data){
	if(data.success && data.data.length){
		allGroup = data.data
		var html = template("agencyTemp", {list : allGroup});
		$(".save_use_agency").last().html(html);
		$(".save_use_ass").last().html(html);
	}
})

$("#addAgency").click(function(){
	var num  = $(".agencyList").length;
	if(num >= 3){
		warning("", "只能添加3个推荐位");
		return;
	}

	var html = template("agencysTemp", {});
	$(html).insertAfter($(".agencyList").last());
	var html = template("agencyTemp", {list : allGroup});
	$(".save_use_agency").last().html(html);
	$(".del_agency").unbind("click");
	$(".del_agency").bind("click", function(){
		$(this).parents(".agencyList").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})

$("#agencySub").click(function(){
	var agencyId = [];
	$.each($(".save_use_agency"), function(index, item){
		if($(item).val()){
			agencyId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_index_group", {

		data : agencyId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})

// //获得已选首页的机构栏

$.getq(que, url + "recommend/get_index_group", function(data){
	if(data.success){
		var len = data.data.length;
		$.each(data.data, function(k, v){
			$(".save_use_agency").eq(k).val(v.id);
			if(k < len - 1){
				$("#addAgency").click();
			}
		})

	}
})

// 项目的首页

var prohome;
$.getq(que, url+"recommend/get_index", function (data){
	if(data.success && data.data.length){
		prohome = data.data
		var html = template("pro_home_Temp", {list : prohome});
		$(".save_pro_home").last().html(html);
		// $(".save_use_pro").last().html(html);
	}
})

$("#add_pro_home").click(function(){
	var num  = $(".pro_home_List").length;
	if(num >= 4){
		warning("", "只能添加4个推荐位");
		return;
	}

	var html = template("prohomeTemp", {});
	$(html).insertAfter($(".pro_home_List").last());
	var html = template("pro_home_Temp", {list : allProjects});
	$(".save_pro_home").last().html(html);
	$(".del_pro").unbind("click");
	$(".del_pro").bind("click", function(){
		$(this).parents(".pro_home_List").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})

$("#pro_home_Sub").click(function(){
	var proItemId = [];
	$.each($(".save_pro_home"), function(index, item){
		if($(item).val()){
			proItemId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_index_recommend", {

		data : proItemId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})


//获得已选项目的首页栏

$.getq(que, url + "recommend/get_index_recommend", function(data){
	if(data.success){
		var len = data.data.length;
		$.each(data.data, function(k, v){
			$(".save_pro_home").eq(k).val(v.id);
			if(k < len - 1){
				$("#add_pro_home").click();
			}
		})

	}
})



// 项目的首页大图

var propic;
$.getq(que, url+"recommend/get_project", function (data){
	if(data.success && data.data.length){
		propic = data.data
		var html = template("pro_pic_Temp", {list : propic});
		$(".save_pro_pic").last().html(html);
		// $(".save_use_pro").last().html(html);
	}
})


$("#add_pro_pic").click(function(){
	var num  = $(".pro_pic_List").length;
	if(num >= 1){

		warning("", "只能添加1个推荐位");
		return;
	}

	// var html = template("propicTempp", {});
	// $(html).insertAfter($(".pro_pic_List").last());
	// var html = template("pro_pic_Temp", {list : allProjects});
	// $(".save_pro_pic").last().html(html);
	// $(".del_pro_pic").unbind("click");
	// $(".del_pro_pic").bind("click", function(){
	// 	$(this).parents(".pro_pic_List").remove();
	// });
	// $(".caret").parent().bind("click", function(){
	// });
})

$("#pro_pic_Sub").click(function(){
	var picItemId = [];
	$.each($(".save_pro_pic"), function(index, item){
		if($(item).val()){
			picItemId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_big_recommend", {

		data : picItemId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})


//获得已选首页的首页大图

$.getq(que, url + "recommend/get_big_recommend", function(data){
	waitingDialog.hide();
	if(data.success){
		var len = data.data.length;
		$.each(data.data, function(k, v){
			$(".save_pro_pic").eq(k).val(v.id);
			if(k < len - 1){
				$("#add_pro_pic").click();
			}
		})
	}
})

// //获得已选项目
var loadproject = true;
$("#showProject").click(function(){
	if(loadproject){
		$.getq(que, url + "recommend/get_order_project", function(data){
			if(data.success){
				var len = data.data.length;
				$.each(data.data, function(k, v){
					$(".save_use_pro").eq(k).val(v.id);
					if(k < len - 1){
						$("#addProject").click();
					}
				})
				loadproject = false;
			}
		})
	}
})





//获得已选设备
var loaddevice = true;
$("#showDevice").click(function(){
	if(loaddevice){
		$.getq(que, url + "recommend/get_order_device", function(data){
			if(data.success){
				var len = data.data.length;
				$.each(data.data, function(k, v){
					$(".save_use_device").eq(k).val(v.id);
					if(k < len - 1){
						$("#addDevice").click();
					}
				})
				loaddevice = false;
			}
		})
	}
})

//获得已选技术
var loadtech = true;
$("#showTech").click(function(){
	if(loadtech){
		$.getq(que, url + "recommend/get_order_tech", function(data){
			if(data.success){
				var len = data.data.length;
				$.each(data.data, function(k, v){
					$(".save_use_tech").eq(k).val(v.id);
					if(k < len - 1){
						$("#addTech").click();
					}
				})
				loadtech = false;
			}
		})
	}
})


//获得已选机构
var loadass = true;
$("#showAss").click(function(){
	if(loadass){
		$.getq(que, url + "recommend/get_order_group", function(data){
			if(data.success){
				var len = data.data.length;
				$.each(data.data, function(k, v){
					$(".save_use_ass").eq(k).val(v.id);
					if(k < len - 1){
						$("#addAss").click();
					}
				})
				loadass = false;
			}
		})
	}
})




//添加项目
// var project;
// $.getq(que, url+"recommend/get_project", function (data){
// 	if(data.success && data.data.length){
// 		project = data.data
// 		var html = template("proTemp", {list : project});
// 		$(".save_use_pro").last().html(html);
// 	}
// })

$("#addProject").click(function(){
	var num  = $(".projectList").length;
	if(num >= 5){
		warning("", "只能添加5个推荐位");
		return;
	}
	var html = template("projectTemp", {});
	$(html).insertAfter($(".projectList").last());
	var html = template("proTemp", {list : allProjects});
	$(".save_use_pro").last().html(html);
	$(".del_project").unbind("click");
	$(".del_project").bind("click", function(){
		$(this).parents(".projectList").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})





// 设备
// var device;
// $.getq(que, url+"recommend/get_device", function (data){

// 	if(data.success && data.data.length){
// 		device = data.data
// 		var html = template("devTemp", {list : device});
// 		$(".save_use_device").last().html(html);
// 	}
// })

$("#addDevice").click(function(){
	var num  = $(".deviceList").length;
	if(num >= 5){
		warning("", "只能添加5个推荐位");
		return;
	}
	var html = template("deviceTemp", {});
	$(html).insertAfter($(".deviceList").last());
	var html = template("devTemp", {list : allDevice});
	$(".save_use_device").last().html(html);allDevice
	$(".del_device").unbind("click");
	$(".del_device").bind("click", function(){
		$(this).parents(".deviceList").remove();
	})
	$(".caret").parent().bind("click", function(){
	});
})

// 技术
// var tech;
// $.getq(que, url+"recommend/get_tech", function (data){
// 	if(data.success && data.data.length){
// 		tech = data.data
// 		var html = template("tecTemp", {list : tech});
// 		$(".save_use_tech").last().html(html);
// 	}
// })

$("#addTech").click(function(){
	var num  = $(".techList").length;
	if(num >= 5){
		warning("", "只能添加5个推荐位");
		return;
	}
	var html = template("techTemp", {});
	$(html).insertAfter($(".techList").last());
	var html = template("tecTemp", {list : allTechs});
	$(".save_use_tech").last().html(html);
	$(".del_tech").unbind("click");
	$(".del_tech").bind("click", function(){
		$(this).parents(".techList").remove();
	})
	$(".caret").parent().bind("click", function(){
	});
})

// 机构
// var ass;
// $.getq(que, url+"recommend/get_group", function (data){
// 	if(data.success && data.data.length){
// 		ass = data.data
// 		var html = template("ass1Temp", {list : ass});
// 		$(".save_use_ass").last().html(html);
// 	}
// })


$("#addAss").click(function(){
	var num  = $(".assList").length;
	if(num >= 5){
		warning("", "只能添加5个推荐位");
		return;
	}
	var html = template("assTemp", {});
	$(html).insertAfter($(".assList").last());
	var html = template("ass1Temp", {list : allGroup});
	$(".save_use_ass").last().html(html);
	$(".del_ass").unbind("click");
	$(".del_ass").bind("click", function(){
		$(this).parents(".assList").remove();
	})
	$(".caret").parent().bind("click", function(){
	});
})


//生意圈


// 获得已选生意圈
var business;
var loadmoney = true;
$("#showMoney").click(function(){

	$.getq(que, url+"recommend/get_user", function (data){
		if(data.success && data.data.length){
			business = data.data
			var html = template("moneyTemp", {list : business});
			$(".save_use_money").last().html(html);
		}
	})
	if(loadmoney){
		$.getq(que, url + "recommend/get_order_user", function(data){
			if(data.success){
				var len = data.data.length;
				$.each(data.data, function(k, v){
					$(".save_use_money").eq(k).val(v.id);
					if(k < len - 1){
						$("#addMoney").click();
					}
				})
				loadmoney = false;
			}
		})
	}
})



$("#addMoney").click(function(){
	var num  = $(".moneyList").length;
	if(num >= 10){
		warning("", "只能添加10个推荐位");
		return;
	}

	var html = template("businessTemp", {});
	$(html).insertAfter($(".moneyList").last());
	var html = template("moneyTemp", {list : business});
	$(".save_use_money").last().html(html);
	$(".del_money").unbind("click");
	$(".del_money").bind("click", function(){
		$(this).parents(".moneyList").remove();
	});
	$(".caret").parent().bind("click", function(){
	});
})


//项目
$("#proSub").click(function(){
	var projectId = [];
	$.each($(".save_use_pro"), function(index, item){
		if($(item).val()){
			projectId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_project", {

		data : projectId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})

//设备
$("#deviceSub").click(function(){

	var deviceId = [];
	$.each($(".save_use_device"), function(index, item){
		if($(item).val()){
			deviceId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_device", {

		data : deviceId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.reload();
			// },2000)
		}
	})

})

//技术
$("#techSub").click(function(){

	var techId = [];
	$.each($(".save_use_tech"), function(index, item){
		if($(item).val()){
			techId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_tech", {

		data : techId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})

// 机构
$("#assSub").click(function(){

	var assId = [];
	$.each($(".save_use_ass"), function(index, item){
		if($(item).val()){
			assId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_group", {

		data : assId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})


//生意圈
$("#moneySub").click(function(){
	var moneyId = [];
	$.each($(".save_use_money"), function(index, item){
		if($(item).val()){
			moneyId.push($(item).val());
		}
	});

	$.post(url+"recommend/update_user", {

		data : moneyId

	},function (data){
		if(data.success){
			success("", "提交成功");
			// setTimeout(function(){
			// 	window.location.href=url+"";
			// },2000)
		}
	})

})




$(function(){
    //上移
    var $up = $(".up")
    $up.click(function() {
        var $div = $(this).parents(".replace");
        if ($div.index() != 0) {
            $div.fadeOut().fadeIn();
            $div.prev().before($div);

        }
    });
    //下移
    var $down = $(".down");
    var len = $down.length;
    $down.click(function() {
        var $div = $(this).parents(".replace");
        if ($div.index() != len - 1) {
            $div.fadeOut().fadeIn();
            $div.next().after($div);
        }
    });
});

</script>

</html>